package com.ssg1_8;

public class ArrayExe_3 {
    public static void main(String[] args) {
        //数组复制
        int [] array1,array2;
        array1=new int[]{1,23,4,5,6,7,8,8,9,23,456,578};
        array2=new int[array1.length];
        for (int i = 0; i < array1.length; i++) {
            System.out.print(array1[i]+"\t");
        }
        System.out.println("");
//        array2=array1;//将array1的地址值给array2
        //修改array2中的偶索引元素，使其等于索引值
        for (int i=0;i<array1.length;i++){
            array2[i]=array1[i];
        }
       /* for (int i = 0; i < array2.length; i++) {
            if(i%2==0){
                array2[i]=i;
            }
        }*/
        for (int i = 0; i < array2.length; i++) {
            System.out.print(array2[i]+"\t");
        }


    }
}
